home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / program / amcfp140.lha / AMCAF_Examples / FileRequester.AMOS / FileRequester.amosSourceCode
AMOS Source Code  |  1996-01-19  |  34KB  |  1,269 lines

  1. ' *************************************
  2. ' *                                   *
  3. ' *     AMCAF File-Requester V1.2     *
  4. ' *        NOW NTSC COMPATIBLE!       *
  5. ' *      Written by Chris Hodges      *
  6. ' *                                   *
  7. ' *************************************
  8. '
  9. ' FILEREQ[screen,width,height,ypos,title$,file$,dir$,pat$,ok$,abort$,font$,options$]   
  10. '
  11. '   Opens a font sensitive, very nice file-requester.
  12. '  
  13. '�  Screen   Any screen number from 0 to 7. When using -1, the file requester  
  14. '            will take a free one. 
  15. '   Width    Width of the requester from 160 to 640. The screen will be
  16. '            centered automatically. 
  17. '   Height   Height of the file requester. The minimum is 96 and the maximum 
  18. '            256.  
  19. '   Ypos     Gives your control over the position of the selector. If it is
  20. '            set to zero, the requester will be centered on the screen.
  21. '   Title$   Screen title. 
  22. '   File$    Default filename. 
  23. '   Dir$     Default directory. If none is given, the current directory will 
  24. '            be taken instead.   
  25. '   Pat$     Searching pattern string. This filters the files in the 
  26. '            selection window. Pattern matching works only on Kick 2.04 and
  27. '            over. Note, that if you don't have Option 'P' enabled, the user 
  28. '            cannot alter this pattern.
  29. '   Ok$      The text, that appears in the positive button.
  30. '   Abort$   The text, that is shown in the negative button. 
  31. '   Font$    Let's you use any font you want. If you select an other bigger
  32. '            font, change the dimensions of the screen respectively. 
  33. '            The font must be entered like so: two digits height and then the  
  34. '            name: e.g "24Helvetica" or "11Topaz". 
  35. '            There are a few problems with proportional fonts, but they will 
  36. '            work as well. 
  37. '            When Font$ is an empty string, normal Topaz 8 will be chosen. 
  38. '          
  39. '   Options$ Contains some letters with enable or disable a particular 
  40. '            function. Possible options: 
  41. '  
  42. '            P=Enable Pattern Matching Box. The user now may edit the pattern. 
  43. '            R=Reread directory on opening. Should be used e.g after saving. 
  44. '            D=Lists directories only. 
  45. '              Only use it in conjunction with the R-Option. 
  46. '              Disable the pattern matching box, as it has no function anymore.  
  47. '            Q=Disables Date, Time, and Comment strings. 
  48. '            S=Disables double clicking (e.g for Save-Requesters). 
  49. '
  50. ' FILEREQNOTIFY
  51. '  
  52. '   Clears the current filelist because it's not up to date. (e.g
  53. '   after saving). 
  54. '  
  55. ' REQUESTER[body$,choices$]
  56. '
  57. '   Opens a requester on the current screen, or if it doesn't fit, it opens
  58. '   the dialogbox on the next free screen. The result is given in Param. 
  59. '
  60. '   Body$    Contains the title text of the dialogbox. The text will be word 
  61. '            wrapped to fit. 
  62. '   Choices$ Contains the different choices for this requester. The single 
  63. '            items must be seperated by an "|" character.
  64. '
  65. ' Use the other procedures as you like, but don't use the buttons from 1 to
  66. ' 25 for your programs.
  67. '
  68. ' Short explainations of the other procedures: 
  69. '
  70. ' CHKMOUSE[xm,ym,lower,upper]
  71. '
  72. '   Checks if the mouse is inside a button. Xm,ym are the mouse coordinates
  73. '   on the screen. Lower represents the first button to be checked and upper 
  74. '   the last one. The function will return the button number pressed or 0, if
  75. '   no button has been clicked on. Normally, this procedure includes the 
  76. '   graphical echo and so on, but this can be disabled by setting bit 1 in 
  77. '   the button flags.
  78. '
  79. ' DEFTEX[bt,x1,y1,x2,y2,t$,fl] 
  80. '
  81. '   Defines a text button. bt is the button number. x1,y1 to x2,y2 define the  
  82. '   dimensions of the button. t$ is used for the button text. Note that it 
  83. '   will be shortened, if it doesn't fit, so you'll never get any graphical
  84. '   mess on the screen. fl are the button flags:   
  85. '
  86. '   Bit 0=0: Button is disabled. The user cannot click on it.  
  87. '   Bit 0=1: Button is enabled. The user can press the button as he wants to.  
  88. '   Bit 1=0: CHKMOUSE will to the graphical response for the button. 
  89. '   Bit 1=1: Special Button: the CHKMOUSE routine will return immediately. 
  90. '   Bit 2=0: Button is drawn in normal video.  
  91. '   Bit 2=1: The button will be drawn as pressed in inverse video. 
  92. '
  93. '   Also there are some options for the displayed text: If the first letter
  94. '   contains a "{" character, the text will be put out left justified. 
  95. '   Same with "}", but this time the text will be right justified. 
  96. '
  97. '   These flags and textoptions are available in every procedure, that uses
  98. '   these variables. 
  99. '
  100. ' DEFBOX[bt,x1,y1,x2,y2,fl]
  101. '
  102. '   Defines an empty box as a gadget on the screen. See DEFTEX.
  103. '
  104. ' DEFGAD[bt,x1,y1,x2,y2,fl]
  105. '
  106. '   Sets up a invisible button. Use it in conjunction with the Bit 2 flag. 
  107. '
  108. ' DEAGAD[bt] 
  109. '
  110. '   Ghosts a button out and disables it, so it cannot be clicked on anymore. 
  111. '
  112. ' ACTGAD[bt] 
  113. '
  114. '   Re-activates a button again. It will be redrawn with known information.
  115. '
  116. ' DISGAD[bt] 
  117. '
  118. '   Deactivates a gadget, but does not change the graphics. Use it for 
  119. '   borderless zones.
  120. '
  121. ' ENAGAD[bt] 
  122. '
  123. '   Enables a button again, which was previously deactivated by the DISGAD 
  124. '   procedure. No graphical change is done.
  125. '
  126. ' CLRGAD[bt] 
  127. '
  128. '   Clears an disables a button on the screen. 
  129. '
  130. ' PUSHGAD[bt]
  131. '
  132. '   Pushes a button in.
  133. '
  134. ' RELEGAD[bt]
  135. '
  136. '   Releases the gadget again. 
  137. '
  138. ' FILBOX[x1,y1,x2,y2,se] 
  139. '
  140. '   Draws a filled bevel box, which will not be included as real gadget. 
  141. '   x1,y1 to x2,y2 define the dimensions. If se is set to zero, the box
  142. '   will be drawn as normal, if se is 1, the box will be drawn inverse.
  143. '
  144. ' NEWTEX[bt,t$]
  145. '
  146. '   Changes the text inside a button. The button will be updated 
  147. '   immediately. 
  148. '  
  149. ' TEXBOX[x1,y1,x2,y2,se,t$]
  150. '
  151. '   Draws a gadgetbox with some text in it. Like FILBOX, this does not set up
  152. '   a clickable gadget. t$ will be cut off, if the text does not fit.    
  153. '  
  154. ' TEX[x1,y1,x2,y2,t$]
  155. '
  156. '   Prints out a text, which will be placed inside the rectangular area
  157. '   x1,y1 to x2,y2.
  158. '
  159. ' DRABOX[x1,y1,x2,y2,se] 
  160. '
  161. '   Draws the borders of a bevel box. If se is set to 1, the box will be drawn 
  162. '   as if it has been pressed. 
  163. '
  164. ' STRGAD[bt,i$]
  165. '
  166. '   Allows the user to modify the button text. I$ contains the key, that 
  167. '   has been entered into the keyboard. If i$ is an empty string, the  
  168. '   cursor position will be set to the end of the line.
  169. '   If the user has pressed the return key, the resulting parameter will be
  170. '   -1 otherwise 0.
  171. '
  172. ' DEFCLOWIN[bt,x,y]
  173. '
  174. '   Draws and defines a CloseWindow-Gadget at coordinates x,y. 
  175. '
  176. ' DRACLOWIN[x,y] 
  177. '
  178. '   Only draws a CloseWindow-Gadget. 
  179. '
  180. ' DEFSCRTBK[bt,x,y]
  181. '
  182. '   Draws and defines a ScreenToBack-Gadget at coordinates x,y.
  183. '
  184. ' DRASCRTBK[x,y] 
  185. '
  186. '   Only draws a ScreenToBack-Gadget.
  187. '
  188. ' DEFARROWU[bt,x,y]  
  189. '
  190. '   Draws and defines a ArrowUp-Gadget at coordinates x,y. 
  191. '
  192. ' DRAARROWU[x,y] 
  193. '
  194. '   Only draws a ArrowUp-Gadget. 
  195. '
  196. ' DEFARROWD[bt,x,y]    
  197. '
  198. '   Draws and defines a ArrowDown-Gadget at coordinates x,y. 
  199. '
  200. ' DRAARROWD[x,y] 
  201. '
  202. '   Only draws a ArrowDown-Gadget. 
  203. '
  204. ' DRASLIDER[bt,lineoff,pagesize,maxlines,obt]  
  205. '
  206. '   Sets up a slider bar. Therefore gadget obt will be used to create the new
  207. '   Button bt. For checking reasons, obt must be lower than bt.
  208. '   Lineoff sets the current position of the slider. Pagesize defines the
  209. '   size of the slider in units. Maxlines sets the total amount of possible
  210. '   positions. 
  211. '
  212. ' DRAGSLIDER[bt,y,pagesize,maxlines,obt] 
  213. '
  214. '   Drags a slider to a new position. Therefore you must supply the position 
  215. '   of the slider handle. Lineoff is returned via Param. 
  216. '
  217. Set Buffer 40
  218. If Screen<>-1 Then Screen Close 0
  219. MXFILES=300
  220. Dim FIL$(MXFILES)
  221. '
  222. Dim FB(25,4),FB$(25)
  223. Global FB(),FB$()
  224. TH=8
  225. Global TH
  226. FILEREQ[0,640,256,0,"Load a blab.","","","","Load","Abort","",""]
  227. F$=Param$
  228. REQUEST["You've selected file '"+ Extension_8_02F0(F$)+"' in drawer '"+ Extension_8_03E0(F$)+"', correct?","How did you know that?|Really marvellous!"]
  229. REQUEST["Do you have enjoyed this demonstation?","Yes of course!|Rather boring!|Silly!"]
  230. End 
  231. Procedure FILEREQNOTIFY
  232.   Shared FIL$()
  233.   FIL$(0)=""
  234. End Proc
  235. Procedure FILEREQ[SN,SX,SY,YP,T$,F$,D$,PAT$,OK$,FAIL$,FON$,OP$]
  236.   Shared FIL$(),MXFILES
  237.   OTH=TH
  238.   Gosub INIT
  239.   Gosub SETUPSCREEN
  240.   Gosub REFRESH
  241.   Multi Wait : Limit Mouse 
  242.   OMK=0 : EXA=0 : ENT=0
  243.   Do 
  244.     If Timer>25 and RDIR=1
  245.       Sort FIL$(0)
  246.       Gosub REFRESH
  247.       Timer=0
  248.     End If 
  249.     Repeat 
  250.       If RDIR Then Gosub EXAMINDIR Else Multi Wait 
  251.     Until Amos Here
  252.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  253.     If MK=2 Then Gosub DEVLIST
  254.     If I$<>"" and ENT>0
  255.       STRGAD[ENT,I$]
  256.       If Param=-1
  257.         If ENT=6
  258.           F$=Mid$(FB$(6),2) : BT=4
  259.           FIL$(0)= Extension_8_08C4(FILOFF)+ Extension_8_08C4(MXNAMLEN)+RDIR$
  260.           Exit 
  261.         End If 
  262.         If ENT=7
  263.           DD$=D$
  264.           D$=Mid$(FB$(7),2)
  265.           If Exist(D$)
  266.             Gosub NEWREAD
  267.           Else 
  268.             REQUEST["Directory "+D$+" not found!","Oh sorry!"]
  269.             D$=DD$
  270.             NEWTEX[7,"{"+D$]
  271.           End If 
  272.         End If 
  273.         If ENT=8
  274.           PAT$=Mid$(FB$(8),2)
  275.           Gosub NEWREAD
  276.         End If 
  277.         ENT=0
  278.       End If 
  279.     End If 
  280.     BT=0
  281.     If MK=1 and OMK<>1
  282.       CHKMOUSE[XM,YM,1,15]
  283.       BT=Param
  284.     End If 
  285.     If BT and ENT Then NEWTEX[ENT,FB$(ENT)] : ENT=0
  286.     If BT=1 Then Gosub DRAGSCREEN
  287.     If BT=11 Then Gosub SELECT
  288.     If BT=2 or BT=4 or BT=5
  289.       If RDIR
  290.         FIL$(0)=""
  291.       Else 
  292.         FIL$(0)= Extension_8_08C4(FILOFF)+ Extension_8_08C4(MXNAMLEN)+RDIR$
  293.       End If 
  294.       Exit 
  295.     End If 
  296.     If BT=3 Then Amos To Back 
  297.     If BT>5 and BT<9 Then ENT=BT : STRGAD[BT,""]
  298.     If BT=9 Then Gosub DEVLIST
  299.     If BT=10 Then Gosub PARDIR
  300.     If BT=12 Then Gosub DRAGSLIDER
  301.     If BT=13 Then Gosub ARROWUP
  302.     If BT=14 Then Gosub ARROWDOWN
  303.     If BT=15 Then Gosub FLIPPAGE
  304.     OMK=MK
  305.   Loop 
  306.   Screen Close SN
  307.   For A=1 To 15
  308.     DISGAD[A]
  309.   Next 
  310.   If BT=4 Then A$= Extension_8_03EC(D$)+F$ Else A$=""
  311.   TH=OTH
  312.   Trap Limit Mouse 
  313. Pop Proc[A$]
  314. INIT:
  315.   If SN<0
  316.     For A=0 To 7
  317.       Trap Screen A
  318.       If Errtrap : SN=A : Exit : End If 
  319.     Next 
  320.   End If 
  321.   If T$="" Then T$="AMCAF File Selector"
  322.   If D$="" Then D$= Extension_8_03E0(Dir$)
  323.   If Instr(OP$,"P") Then PAT=1 Else PAT=0
  324.   If Instr(OP$,"R") Then FIL$(0)=""
  325.   If Instr(OP$,"D") Then DIONLY=1 Else DIONLY=0
  326.   If Instr(OP$,"Q") Then QUICK=1 Else QUICK=0
  327.   If Instr(OP$,"S") Then SAVREQ=1 Else SAVREQ=0
  328.   KICK=Deek(Leek(4)+20)
  329.   If KICK<37 Then PAT=0
  330.   SX=Max(Min((SX+15) and $FFE0,640),160)
  331.   SY=Max(Min(SY,256+Ntsc*56),96)
  332.   If YP<40 Then YP=168-SY/2+Ntsc*28
  333.   If FIL$(0)<>""
  334.     RDIR$=Mid$(FIL$(0),5)
  335.     If D$<>RDIR$
  336.       FIL$(0)=""
  337.       RDIR=1 : NUMFIL=0 : FILOFF=0
  338.       Return 
  339.     End If 
  340.     For A=1 To MXFILES
  341.       Exit If FIL$(A)=Chr$(255)
  342.     Next 
  343.     SELFIL=-1 : NUMFIL=A-1 : FILOFF= Extension_8_098C(FIL$(0))
  344.     MXNAMLEN= Extension_8_098C(Mid$(FIL$(0),3))
  345.     RDIR=0
  346.   Else 
  347.     RDIR=1 : NUMFIL=0 : FILOFF=0 : SELFIL=-1
  348.   End If 
  349. Return 
  350. SETUPSCREEN:
  351.   Screen Open SN,SX,SY,4,$8000
  352.   Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  353.   Palette 0,$FFF,$AAA,$666
  354.   Colour 17,$BDF : Colour 18,$6F : Colour 19,$12
  355.   Screen Display SN,288-SX/4,YP,SX,SY
  356.   If FON$<>""
  357.     A=Val(Left$(FON$,2))
  358.     If A>0
  359.       Trap Extension_8_05B0 Mid$(FON$,3),A
  360.       If Errtrap=0
  361.         TH=A
  362.       End If 
  363.     End If 
  364.   End If 
  365.   Gr Writing 0
  366.   DEFCLOWIN[2,0,0]
  367.   FILBOX[0,TH+3,SX-1,SY-1,0]
  368.   DEFTEX[1,19,0,SX-24,TH+2,"{"+T$,3]
  369.   DEFSCRTBK[3,SX-23,0]
  370.   A=Text Length("Pattern:")+8
  371.   If DIONLY=0
  372.     DEFTEX[6,A,SY-TH*2-9,SX-5,SY-TH-7,"{"+F$,7]
  373.     TEX[4,FB(6,1),FB(6,0),FB(6,3),"}File:"]
  374.     FY2=SY-TH*3-13
  375.   Else 
  376.     FY2=SY-TH*2-9
  377.   End If 
  378.   DEFTEX[7,A,FY2,SX-5,FY2+TH+2,"{"+D$,7]
  379.   TEX[4,FB(7,1),FB(7,0),FB(7,3),"}Dir:"]
  380.   If PAT
  381.     DEFTEX[8,A,FY2-TH-4,SX-5,FY2-2,"{"+PAT$,7]
  382.     TEX[4,FB(8,1),FB(8,0),FB(8,3),"}Pattern:"]
  383.     FY2=FB(8,1)-2
  384.   Else 
  385.     FY2=FB(7,1)-2
  386.   End If 
  387.   DEFTEX[4,4,SY-TH-5,SX/4-2,SY-3,OK$,1]
  388.   DEFTEX[9,SX/4+1,SY-TH-5,SX/2-3,SY-3,"Devices",1]
  389.   DEFTEX[10,SX/2,SY-TH-5,SX/2+SX/4-4,SY-3,"Parent",1]
  390.   If Right$(D$,1)=":" Then DEAGAD[10]
  391.   DEFTEX[5,SX/2+SX/4-1,SY-TH-5,SX-5,SY-3,FAIL$,1]
  392.   DEFARROWU[13,SX-22,FY2-17]
  393.   DEFARROWD[14,SX-22,FY2-8]
  394.   D=(FY2-TH-9)
  395.   MXLIN=D/TH
  396.   FY1=TH+7+(D-TH*MXLIN)/2
  397.   DEFBOX[15,SX-22,TH+5,SX-5,FY2-18,3]
  398.   DRASLIDER[15,FILOFF,MXLIN,NUMFIL,12]
  399. Return 
  400. PARDIR:
  401.   If Right$(D$,1)=":" Then Return 
  402.   If RDIR Then Extension_8_0660 
  403.   D$= Extension_8_03E0(D$)
  404.   Gosub NEWREAD
  405. Return 
  406. NEWREAD:
  407.   If RDIR Then Extension_8_0660 
  408.   NEWTEX[7,"{"+D$]
  409.   EXA=0 : RDIR=1 : Gosub EXAMINDIR
  410.   If Right$(D$,1)=":" Then DEAGAD[10] Else ACTGAD[10]
  411.   ACTGAD[9]
  412. Return 
  413. DEVLIST:
  414.   If RDIR=1 or Left$(FIL$(NUMFIL),1)>="A" Then Return 
  415.   FILOFF=NUMFIL
  416.   F$=Dev First$("")
  417.   While NUMFIL<MXFILES and(F$<>"")
  418.     F$=Mid$(F$,2,Instr(F$,":")-1)
  419.     TYP= Extension_8_02D0(F$)
  420.     If TYP=0
  421.       MXNAMLEN=Max(MXNAMLEN,Len(F$))
  422.       Request Off 
  423.       Trap Extension_8_0672 F$
  424.       A=Errtrap
  425.       Request On 
  426.       If A=0
  427.         NAM$= Extension_8_06D8 
  428.         SOR$="A"+Upper$(F$)+Chr$(0)+"  <Dev> "+F$+Chr$(0)+" ("+NAM$+") "
  429.       Else 
  430.         SOR$="A"+Upper$(F$)+Chr$(0)+"  <Dev> "+F$+Chr$(0)+" "+ Extension_8_0522( Extension_8_0532 )
  431.       End If 
  432.       Inc NUMFIL
  433.       FIL$(NUMFIL)=SOR$
  434.     End If 
  435.     If TYP=1
  436.       MXNAMLEN=Max(MXNAMLEN,Len(F$))
  437.       Inc NUMFIL
  438.       FIL$(NUMFIL)="B"+Upper$(F$)+Chr$(0)+"  <Dir> "+F$+Chr$(0)+" Assign"
  439.     End If 
  440.     F$=Dev Next$
  441.   Wend 
  442.   Sort FIL$(0)
  443.   FILOFF=Min(FILOFF,NUMFIL-MXLIN)
  444.   Gosub REFRESH
  445.   DEAGAD[9]
  446. Return 
  447. SELECT:
  448.   Y=YM-FY1
  449.   If Y<0 or Y>=FY1+MXLIN*TH Then Return 
  450.   F=Y/TH+FILOFF+1
  451.   If F>NUMFIL Then Return 
  452.   TYP=Asc(FIL$(F))
  453.   A$=Peek$(Varptr(FIL$(F))+Instr(FIL$(F),Chr$(0))+8,40,Chr$(0))
  454.   If TYP=32
  455.     D$= Extension_8_03EC(D$)+A$
  456.     Gosub NEWREAD
  457.   End If 
  458.   If TYP=45
  459.     F$=A$
  460.     NEWTEX[6,"{"+F$]
  461.     If SELFIL<>F
  462.       If SELFIL-FILOFF=>0 and SELFIL-FILOFF<=MXLIN
  463.         A=SELFIL-FILOFF-1 : SELFIL=-1
  464.         Gosub LISTFILE
  465.       End If 
  466.       SELFIL=F : A=SELFIL-FILOFF-1 : Timer=0
  467.       Gosub LISTFILE
  468.     Else 
  469.       If Timer<50 and SAVREQ=0
  470.         BT=4
  471.       End If 
  472.     End If 
  473.   End If 
  474.   If TYP=65 or TYP=66
  475.     D$=A$ : Gosub NEWREAD
  476.   End If 
  477. Return 
  478. DRAGSCREEN:
  479.   PUSHGAD[BT]
  480.   A=YM
  481.   Limit Mouse X Hard(0),40+A To X Hard(SX-1),296-SY+A+Ntsc*56
  482.   Repeat 
  483.     If RDIR : Gosub EXAMINDIR : Else Multi Wait : End If 
  484.     YM=Y Screen(Y Mouse)-A : MK=Mouse Key : I$=Inkey$
  485.     Add YP,YM
  486.     Screen Display SN,,YP,,
  487.   Until MK<>1
  488.   Multi Wait : Limit Mouse 
  489.   OMK=1
  490.   RELEGAD[BT]
  491. Return 
  492. ARROWUP:
  493.   PUSHGAD[BT]
  494.   Repeat 
  495.     Multi Wait 
  496.     MK=Mouse Key : I$=Inkey$
  497.     If FILOFF>0
  498.       Dec FILOFF
  499.       Gosub SCROLFILES
  500.     End If 
  501.   Until MK<>1
  502.   RELEGAD[BT]
  503. Return 
  504. ARROWDOWN:
  505.   PUSHGAD[BT]
  506.   Repeat 
  507.     Multi Wait 
  508.     MK=Mouse Key : I$=Inkey$
  509.     If FILOFF<NUMFIL-MXLIN
  510.       Inc FILOFF
  511.       Gosub SCROLFILES
  512.     End If 
  513.   Until MK<>1
  514.   RELEGAD[BT]
  515. Return 
  516. DRAGSLIDER:
  517.   DISGAD[12]
  518.   O=YM-FB(12,1)
  519.   Repeat 
  520.     Multi Wait 
  521.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  522.     DRAGSLIDER[15,YM-O,MXLIN,NUMFIL,12]
  523.     If NUMFIL>MXLIN
  524.       FILOFF=Param
  525.       Gosub SCROLFILES
  526.     End If 
  527.   Until MK<>1
  528.   ENAGAD[12]
  529.   DRASLIDER[15,FILOFF,MXLIN,NUMFIL,12]
  530.   OMK=1
  531. Return 
  532. REFRESH:
  533.   DEFBOX[11,4,TH+5,SX-25,FY2,7]
  534.   If NUMFIL>0
  535.     For A=0 To Min(MXLIN-1,NUMFIL-1)
  536.       Gosub LISTFILE
  537.     Next 
  538.     OLDOFF=FILOFF
  539.   End If 
  540.   If FB(12,4) and 1 Then DRASLIDER[15,FILOFF,MXLIN,NUMFIL,12]
  541. Return 
  542. SCROLFILES:
  543.   If OLDOFF=FILOFF Then Return 
  544.   X1=FB(11,0)+2 : X2=FB(11,2)-2 : Y1=FY1+1 : Y2=FY1+TH*MXLIN+1
  545.   D=FILOFF-OLDOFF
  546.   If Abs(D)>MXLIN-2 Then Gosub REFRESH : Return 
  547.   If D>0
  548.     Screen Copy SN,X1,Y1+D*TH,X2,Y2 To SN,X1,Y1
  549.     For A=MXLIN-D To MXLIN-1
  550.       Gosub LISTFILE
  551.     Next 
  552.   Else 
  553.     Screen Copy SN,X1,Y1,X2,Y2+D*TH To SN,X1,Y1-D*TH
  554.     For A=0 To -D-1
  555.       Gosub LISTFILE
  556.     Next 
  557.   End If 
  558.   OLDOFF=FILOFF
  559.   If FB(12,4) and 1 Then DRASLIDER[15,FILOFF,MXLIN,NUMFIL,12]
  560. Return 
  561. FLIPPAGE:
  562.   If NUMFIL<MXLIN Then Return 
  563.   If YM>(FB(12,1)+FB(12,3))/2
  564.     FILOFF=Min(FILOFF+MXLIN,NUMFIL-MXLIN)
  565.   Else 
  566.     FILOFF=Max(FILOFF-MXLIN,0)
  567.   End If 
  568.   Gosub REFRESH
  569.   DRASLIDER[15,FILOFF,MXLIN,NUMFIL,12]
  570. Return 
  571. LISTFILE:
  572.   If QUICK
  573.     A$=FIL$(A+FILOFF+1)
  574.     A$=Peek$(Varptr(A$)+Instr(A$,Chr$(0)),40,Chr$(0))
  575.   Else 
  576.     A$=FIL$(A+FILOFF+1)
  577.     B$=Mid$(A$,Instr(A$,Chr$(0))+1)
  578.     FIL$=Left$(B$,Instr(B$,Chr$(0))-1)
  579.     RES$=Mid$(B$,Len(FIL$)+2)
  580.     A$=FIL$+Space$(MXNAMLEN-(Len(FIL$)-8))+RES$
  581.   End If 
  582.   If Asc(FIL$(A+FILOFF+1))<>45
  583.     TEX2[6,FY1+A*TH,SX-28,FY1+(A+1)*TH+1,"{"+A$]
  584.   Else 
  585.     TEX[6,FY1+A*TH,SX-28,FY1+(A+1)*TH+1,"{"+A$]
  586.   End If 
  587.   If A+FILOFF+1=SELFIL
  588.     Gr Writing 2
  589.     Ink 2 : Bar 8,FY1+A*TH+1 To SX-29,FY1+(A+1)*TH
  590.     Gr Writing 0
  591.   End If 
  592. Return 
  593. EXAMINDIR:
  594.   If EXA=0
  595.     FILOFF=0 : NUMFIL=0 : MXNAMLEN=5 : RDIR$=D$
  596.     SELFIL=-1
  597.     For A=1 To MXFILES
  598.       FIL$(A)=Chr$(255)
  599.     Next 
  600.     Trap Extension_8_063A D$
  601.     If Errtrap=0
  602.       EXA=1 : Timer=0
  603.     Else 
  604.       Gosub REFRESH
  605.       REQUEST[ Extension_8_0522( Extension_8_0532 )+"!","Cancel"]
  606.       RDIR=0 : Return 
  607.     End If 
  608.   End If 
  609.   If NUMFIL=MXFILES
  610.      Extension_8_0660 
  611.     Sort FIL$(0)
  612.     RDIR=0
  613.     Gosub REFRESH
  614.     Return 
  615.   End If 
  616.   FIL$= Extension_8_064C 
  617.   If FIL$=""
  618.     Sort FIL$(0)
  619.     Timer=0 : RDIR=0 : Gosub REFRESH
  620.     Return 
  621.   End If 
  622.   TYP= Extension_8_0688 
  623.   If QUICK=0
  624.     DATE$=Mid$( Extension_8_0F0A( Extension_8_06F4 ),4)+" "+ Extension_8_0F1A( Extension_8_070E )
  625.     COM$= Extension_8_0762 
  626.     FLAG$= Extension_8_0728( Extension_8_0742 )
  627.   End If 
  628.   If TYP<0
  629.     If DIONLY=0
  630.       If KICK>36
  631.         A= Extension_8_0300(FIL$,PAT$)
  632.       Else 
  633.         A=-1
  634.       End If 
  635.     Else 
  636.       A=0
  637.     End If 
  638.     If A
  639.       MXNAMLEN=Max(MXNAMLEN,Len(FIL$))
  640.       SIZE$= Extension_8_0EC8( Extension_8_06A2 ,7)
  641.       Inc NUMFIL
  642.       If QUICK
  643.         FIL$(NUMFIL)="-"+Upper$(FIL$)+Chr$(0)+SIZE$+" "+FIL$+Chr$(0)
  644.       Else 
  645.         SOR$="-"+Upper$(FIL$)+Chr$(0)+SIZE$+" "+FIL$+Chr$(0)+DATE$+" "+FLAG$+" "+COM$
  646.         FIL$(NUMFIL)=SOR$
  647.       End If 
  648.     End If 
  649.   Else 
  650.     MXNAMLEN=Max(MXNAMLEN,Len(FIL$))
  651.     Inc NUMFIL
  652.     If QUICK
  653.       FIL$(NUMFIL)=" "+Upper$(FIL$)+Chr$(0)+"  <Dir> "+FIL$+Chr$(0)
  654.     Else 
  655.       SOR$=" "+Upper$(FIL$)+Chr$(0)+"  <Dir> "+FIL$+Chr$(0)+DATE$+" "+FLAG$+" "+COM$
  656.       FIL$(NUMFIL)=SOR$
  657.     End If 
  658.   End If 
  659. Return 
  660. End Proc
  661. Procedure REQUEST[T$,OP$]
  662.   Dim LIN$(10)
  663.   OPT=1 : OTH=TH
  664.   For A=1 To Len(OP$)
  665.     If Mid$(OP$,A,1)="|" Then Inc OPT
  666.   Next 
  667.   If Screen=-1
  668.     TH=8
  669.     SX=Max(Len(OP$)*8+OPT*32+8+15,320) and $FE0
  670.     LPR=SX/8-2
  671.   Else 
  672.     SX=Max(Text Length(OP$)+OPT*32+8+15,320) and $FE0
  673.     LPR=SX/Text Length("M")-2
  674.   End If 
  675.   LI=0 : LP=1 : LILE=0
  676.   For A=1 To Len(T$)
  677.     P=Asc(Mid$(T$,A,1))
  678.     Inc LILE
  679.     If LILE>LPR
  680.       LIN$(LI)=Mid$(T$,LP,SP-LP+1)
  681.       LP=SP+2 : LILE=A-LP
  682.       Inc LI
  683.     End If 
  684.     If P=32 Then SP=A-1
  685.     If P=167 Then LILE=LPR+2 : SP=A-1
  686.   Next 
  687.   LIN$(LI)=Mid$(T$,LP) : Inc LI
  688.   NBLI=LI-1
  689.   SY=32+LI*TH
  690.   If Screen=-1
  691.     SN=0
  692.     Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  693.     Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  694.     Screen Display SN,288-SX/4,168-SY/2+Ntsc*28,SX,SY
  695.     Palette 0,$FFF,$AAA,$666
  696.     Colour 17,$BDF : Colour 18,$6F : Colour 19,$12
  697.     Screen Show 
  698.     Gr Writing 0
  699.     Wait Vbl : Limit Mouse 
  700.     OLDSCR=-1
  701.     XP=0 : YP=0
  702.   Else 
  703.     If Screen Height<SY or Screen Width<SX or Screen Colour<4
  704.       For A=0 To 7
  705.         Trap Screen A
  706.         If Errtrap : SN=A : Exit : End If 
  707.       Next 
  708.       OLDSCR=Screen
  709.       Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  710.       Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  711.       Screen Display SN,288-SX/4,168-SY/2+Ntsc*28,SX,SY
  712.       Get Palette OLDSCR
  713.       Screen Show 
  714.       Gr Writing 0
  715.       Wait Vbl : Limit Mouse 
  716.       XP=0 : YP=0
  717.     Else 
  718.       XP=(Screen Width-SX)/2
  719.       YP=(Screen Height-SY)/2
  720.       SN=-1
  721.       Get Cblock 9,XP-4,YP-2,SX+16,SY+4
  722.       DRABOX[XP-4,YP-2,XP+SX+3,YP+SY+1,0]
  723.       DRABOX[XP-2,YP-1,XP+SX+1,YP+SY,1]
  724.       Limit Mouse X Hard(XP),Y Hard(YP) To X Hard(XP+SX-1),Y Hard(YP+SY-1)
  725.     End If 
  726.   End If 
  727.   FILBOX[XP,YP,XP+SX-1,YP+SY-1,0]
  728.   For A=0 To NBLI
  729.     TEX[XP+4,YP+4+A*TH,XP+SX-5,YP+12+A*TH,LIN$(A)]
  730.   Next 
  731.   OP=0
  732.   For A=1 To OPT
  733.     NP=Instr(OP$,"|",OP+1) : If NP=0 Then NP=Len(OP$)+1
  734.     T$=Mid$(OP$,OP+1,NP-OP-1)
  735.     X1=XP+4+((A-1)*(SX-6))/OPT
  736.     X2=XP+1+(A*(SX-6))/OPT
  737.     DEFTEX[15+A,X1,YP+SY-TH-14,X2,YP+SY-3,T$,1]
  738.     OP=NP
  739.   Next 
  740.   OMK=0
  741.   Do 
  742.     Repeat : Multi Wait : Until Amos Here
  743.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  744.     BT=0
  745.     If MK=1 and OMK<>1
  746.       CHKMOUSE[XM,YM,16,15+OPT]
  747.       BT=Param
  748.     End If 
  749.     Exit If BT
  750.     OMK=MK
  751.   Loop 
  752.   For A=1 To OPT
  753.     DISGAD[15+A]
  754.   Next 
  755.   Limit Mouse 
  756.   If SN>-1
  757.     Screen Close SN
  758.     If OLDSCR>-1
  759.       Screen OLDSCR
  760.     End If 
  761.   Else 
  762.     Put Cblock 9
  763.     Del Cblock 9
  764.   End If 
  765.   TH=OTH
  766. End Proc[BT-16]
  767. Procedure NUMENT[T$,OP$,DEFNUM,LOWER,UPPER]
  768.   Dim LIN$(10)
  769.   OPT=1 : OTH=TH
  770.   For A=1 To Len(OP$)
  771.     If Mid$(OP$,A,1)="|" Then Inc OPT
  772.   Next 
  773.   If Screen=-1
  774.     TH=8
  775.     SX=Max(Len(OP$)*8+OPT*32+8+15,320) and $FE0
  776.     LPR=SX/8-2
  777.   Else 
  778.     SX=Max(Text Length(OP$)+OPT*32+8+15,320) and $FE0
  779.     LPR=SX/Text Length("M")-2
  780.   End If 
  781.   LI=0 : LP=1 : LILE=0
  782.   For A=1 To Len(T$)
  783.     P=Asc(Mid$(T$,A,1))
  784.     Inc LILE
  785.     If LILE>LPR
  786.       LIN$(LI)=Mid$(T$,LP,SP-LP+1)
  787.       LP=SP+2 : LILE=A-LP
  788.       Inc LI
  789.     End If 
  790.     If P=32 Then SP=A-1
  791.     If P=167 Then LILE=LPR+2 : SP=A-1
  792.   Next 
  793.   LIN$(LI)=Mid$(T$,LP) : Inc LI
  794.   NBLI=LI-1
  795.   SY=48+LI*TH
  796.   If Screen=-1
  797.     SN=0
  798.     Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  799.     Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  800.     Screen Display SN,288-SX/4,168-SY/2+Ntsc*28,SX,SY
  801.     Palette 0,$FFF,$AAA,$666
  802.     Colour 17,$BDF : Colour 18,$6F : Colour 19,$12
  803.     Screen Show 
  804.     Gr Writing 0
  805.     Wait Vbl : Limit Mouse 
  806.     OLDSCR=-1
  807.     XP=0 : YP=0
  808.   Else 
  809.     If Screen Height<SY or Screen Width<SX or Screen Colour<4
  810.       For A=0 To 7
  811.         Trap Screen A
  812.         If Errtrap : SN=A : Exit : End If 
  813.       Next 
  814.       OLDSCR=Screen
  815.       Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  816.       Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  817.       Screen Display SN,288-SX/4,168-SY/2+Ntsc+28,SX,SY
  818.       Get Palette OLDSCR
  819.       Screen Show 
  820.       Gr Writing 0
  821.       Wait Vbl : Limit Mouse 
  822.       XP=0 : YP=0
  823.     Else 
  824.       XP=(Screen Width-SX)/2
  825.       YP=(Screen Height-SY)/2
  826.       SN=-1
  827.       Get Cblock 9,XP-4,YP-2,SX+16,SY+4
  828.       DRABOX[XP-4,YP-2,XP+SX+3,YP+SY+1,0]
  829.       DRABOX[XP-2,YP-1,XP+SX+1,YP+SY,1]
  830.       Limit Mouse X Hard(XP),Y Hard(YP) To X Hard(XP+SX-1),Y Hard(YP+SY-1)
  831.     End If 
  832.   End If 
  833.   FILBOX[XP,YP,XP+SX-1,YP+SY-1,0]
  834.   For A=0 To NBLI
  835.     TEX[XP+4,YP+4+A*TH,XP+SX-5,YP+12+A*TH,LIN$(A)]
  836.   Next 
  837.   DEFTEX[16,XP+4,YP+SY-TH*2-18,XP+SX-5,YP+SY-TH-16,"{"+Mid$(Str$(DEFNUM),2),7]
  838.   OP=0
  839.   For A=1 To OPT
  840.     NP=Instr(OP$,"|",OP+1) : If NP=0 Then NP=Len(OP$)+1
  841.     T$=Mid$(OP$,OP+1,NP-OP-1)
  842.     X1=XP+4+((A-1)*(SX-6))/OPT
  843.     X2=XP+1+(A*(SX-6))/OPT
  844.     DEFTEX[16+A,X1,YP+SY-TH-14,X2,YP+SY-3,T$,1]
  845.     OP=NP
  846.   Next 
  847.   OMK=0
  848.   STRGAD[16,""]
  849.   Do 
  850.     Repeat : Multi Wait : Until Amos Here
  851.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  852.     BT=17
  853.     If I$<>""
  854.       If I$<" " or(I$>="0" and I$<="9")
  855.         If Not(I$="0" and NUM=0)
  856.           STRGAD[16,I$]
  857.           Exit If Param=-1
  858.         End If 
  859.       End If 
  860.     End If 
  861.     NUM=Val(Mid$(FB$(16),2))
  862.     If NUM<LOWER
  863.       NUM=LOWER
  864.       NEWTEX[16,"{"+Mid$(Str$(NUM),2)]
  865.       STRGAD[16,""]
  866.     End If 
  867.     If NUM>UPPER
  868.       NUM=UPPER
  869.       NEWTEX[16,"{"+Mid$(Str$(NUM),2)]
  870.       STRGAD[16,""]
  871.     End If 
  872.     BT=0
  873.     If MK=1 and OMK<>1
  874.       CHKMOUSE[XM,YM,16,16+OPT]
  875.       BT=Param
  876.     End If 
  877.     Exit If BT>16
  878.     OMK=MK
  879.   Loop 
  880.   For A=1 To OPT+1
  881.     DISGAD[15+A]
  882.   Next 
  883.   Limit Mouse 
  884.   If SN>-1
  885.     Screen Close SN
  886.     If OLDSCR>-1
  887.       Screen OLDSCR
  888.     End If 
  889.   Else 
  890.     Put Cblock 9
  891.     Del Cblock 9
  892.   End If 
  893.   TH=OTH
  894.   A$= Extension_8_0EB8(BT-17,1)+Mid$(Str$(NUM),2)
  895. End Proc[A$]
  896. Procedure TXTENT[T$,OP$,DEFTXT$,NUMLET]
  897.   Dim LIN$(10)
  898.   OPT=1 : OTH=TH
  899.   For A=1 To Len(OP$)
  900.     If Mid$(OP$,A,1)="|" Then Inc OPT
  901.   Next 
  902.   If Screen=-1
  903.     TH=8
  904.     SX=Max(Len(OP$)*8+OPT*32+8+15,320) and $FE0
  905.     LPR=SX/8-2
  906.   Else 
  907.     SX=Max(Text Length(OP$)+OPT*32+8+15,320) and $FE0
  908.     LPR=SX/Text Length("M")-2
  909.   End If 
  910.   LI=0 : LP=1 : LILE=0
  911.   For A=1 To Len(T$)
  912.     P=Asc(Mid$(T$,A,1))
  913.     Inc LILE
  914.     If LILE>LPR
  915.       LIN$(LI)=Mid$(T$,LP,SP-LP+1)
  916.       LP=SP+2 : LILE=A-LP
  917.       Inc LI
  918.     End If 
  919.     If P=32 Then SP=A-1
  920.     If P=167 Then LILE=LPR+2 : SP=A-1
  921.   Next 
  922.   LIN$(LI)=Mid$(T$,LP) : Inc LI
  923.   NBLI=LI-1
  924.   SY=48+LI*TH
  925.   If Screen=-1
  926.     SN=0
  927.     Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  928.     Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  929.     Screen Display SN,288-SX/4,168-SY/2+Ntsc*28,SX,SY
  930.     Palette 0,$FFF,$AAA,$666
  931.     Colour 17,$BDF : Colour 18,$6F : Colour 19,$12
  932.     Screen Show 
  933.     Gr Writing 0
  934.     Wait Vbl : Limit Mouse 
  935.     OLDSCR=-1
  936.     XP=0 : YP=0
  937.   Else 
  938.     If Screen Height<SY or Screen Width<SX or Screen Colour<4
  939.       For A=0 To 7
  940.         Trap Screen A
  941.         If Errtrap : SN=A : Exit : End If 
  942.       Next 
  943.       OLDSCR=Screen
  944.       Screen Open SN,SX,SY,4,$8000 : Screen Hide 
  945.       Curs Off : Flash Off : Paper 2 : Pen 1 : Cls 0
  946.       Screen Display SN,288-SX/4,168-SY/2+Ntsc*28,SX,SY
  947.       Get Palette OLDSCR
  948.       Screen Show 
  949.       Gr Writing 0
  950.       Wait Vbl : Limit Mouse 
  951.       XP=0 : YP=0
  952.     Else 
  953.       XP=(Screen Width-SX)/2
  954.       YP=(Screen Height-SY)/2
  955.       SN=-1
  956.       Get Cblock 9,XP-4,YP-2,SX+16,SY+4
  957.       DRABOX[XP-4,YP-2,XP+SX+3,YP+SY+1,0]
  958.       DRABOX[XP-2,YP-1,XP+SX+1,YP+SY,1]
  959.       Limit Mouse X Hard(XP),Y Hard(YP) To X Hard(XP+SX-1),Y Hard(YP+SY-1)
  960.     End If 
  961.   End If 
  962.   FILBOX[XP,YP,XP+SX-1,YP+SY-1,0]
  963.   For A=0 To NBLI
  964.     TEX[XP+4,YP+4+A*TH,XP+SX-5,YP+12+A*TH,LIN$(A)]
  965.   Next 
  966.   DEFTEX[16,XP+4,YP+SY-TH*2-18,XP+SX-5,YP+SY-TH-16,"{"+DEFTXT$,7]
  967.   OP=0
  968.   For A=1 To OPT
  969.     NP=Instr(OP$,"|",OP+1) : If NP=0 Then NP=Len(OP$)+1
  970.     T$=Mid$(OP$,OP+1,NP-OP-1)
  971.     X1=XP+4+((A-1)*(SX-6))/OPT
  972.     X2=XP+1+(A*(SX-6))/OPT
  973.     DEFTEX[16+A,X1,YP+SY-TH-14,X2,YP+SY-3,T$,1]
  974.     OP=NP
  975.   Next 
  976.   OMK=0
  977.   STRGAD[16,""]
  978.   Do 
  979.     Repeat : Multi Wait : Until Amos Here
  980.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  981.     BT=17
  982.     If I$<>""
  983.       STRGAD[16,I$]
  984.       Exit If Param=-1
  985.     End If 
  986.     TXT$=Mid$(FB$(16),2)
  987.     If Len(TXT$)>NUMLET
  988.       NEWTEX[16,"{"+Left$(TXT$,NUMLET)]
  989.       STRGAD[16,""]
  990.     End If 
  991.     BT=0
  992.     If MK=1 and OMK<>1
  993.       CHKMOUSE[XM,YM,16,16+OPT]
  994.       BT=Param
  995.     End If 
  996.     Exit If BT>16
  997.     OMK=MK
  998.   Loop 
  999.   For A=1 To OPT+1
  1000.     DISGAD[15+A]
  1001.   Next 
  1002.   Limit Mouse 
  1003.   If SN>-1
  1004.     Screen Close SN
  1005.     If OLDSCR>-1
  1006.       Screen OLDSCR
  1007.     End If 
  1008.   Else 
  1009.     Put Cblock 9
  1010.     Del Cblock 9
  1011.   End If 
  1012.   TH=OTH
  1013.   A$= Extension_8_0EB8(BT-17,1)+TXT$
  1014. End Proc[A$]
  1015. Procedure CHKMOUSE[XM,YM,LL,UL]
  1016.   For BT=LL To UL
  1017.     If XM=>FB(BT,0) and XM<=FB(BT,2) and YM=>FB(BT,1) and YM<=FB(BT,3) and(FB(BT,4) and 1) Then Exit 
  1018.   Next 
  1019.   If BT>UL Then Pop Proc[0]
  1020.   If FB(BT,4) and 2 Then Pop Proc[BT]
  1021.   OST=-1 : AA=0
  1022.   ST= Extension_8_093A(FB(BT,4) and 4,2)
  1023.   Repeat 
  1024.     Multi Wait 
  1025.     XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse) : MK=Mouse Key : I$=Inkey$
  1026.     If XM=>FB(BT,0) and XM<=FB(BT,2) and YM=>FB(BT,1) and YM<=FB(BT,3) Then A=1 Else A=0
  1027.     If AA<>A Then AA=A : ST=1-ST
  1028.     If OST<>ST
  1029.       If ST
  1030.         PUSHGAD[BT]
  1031.       Else 
  1032.         RELEGAD[BT]
  1033.       End If 
  1034.       OST=ST
  1035.     End If 
  1036.   Until MK<>1
  1037.   If A=0 Then Pop Proc[0]
  1038.   If ST
  1039.     RELEGAD[BT]
  1040.   Else 
  1041.     PUSHGAD[BT]
  1042.   End If 
  1043. End Proc[BT]
  1044. Procedure DEFTEX[BT,X1,Y1,X2,Y2,T$,FL]
  1045.   TEXBOX[X1,Y1,X2,Y2, Extension_8_093A(FL and 4,2),T$]
  1046.   DEFGAD[BT,X1,Y1,X2,Y2,FL]
  1047.   FB$(BT)=T$
  1048. End Proc
  1049. Procedure DEFBOX[BT,X1,Y1,X2,Y2,FL]
  1050.   FILBOX[X1,Y1,X2,Y2, Extension_8_093A(FL and 4,2)]
  1051.   DEFGAD[BT,X1,Y1,X2,Y2,FL]
  1052. End Proc
  1053. Procedure DEFGAD[BT,X1,Y1,X2,Y2,FL]
  1054.   FB(BT,0)=X1 : FB(BT,1)=Y1
  1055.   FB(BT,2)=X2 : FB(BT,3)=Y2
  1056.   FB(BT,4)=FL
  1057.   FB$(BT)=""
  1058. End Proc
  1059. Procedure DEAGAD[BT]
  1060.   If(FB(BT,4) and 1)=0 Then Pop Proc
  1061.   FB(BT,4)=FB(BT,4) and $FE
  1062.   Set Pattern 2
  1063.   Ink 3 : Bar FB(BT,0),FB(BT,1) To FB(BT,2),FB(BT,3)
  1064.   Set Pattern 0
  1065. End Proc
  1066. Procedure ACTGAD[BT]
  1067.   If FB(BT,4) and 1 Then Pop Proc
  1068.   CLRGAD[BT]
  1069.   FB(BT,4)=FB(BT,4) or 1
  1070.   If FB$(BT)<>""
  1071.     TEXBOX[FB(BT,0),FB(BT,1),FB(BT,2),FB(BT,3), Extension_8_093A(FB(BT,4) and 4,2),FB$(BT)]
  1072.   Else 
  1073.     DRABOX[FB(BT,0),FB(BT,1),FB(BT,2),FB(BT,3), Extension_8_093A(FB(BT,4) and 4,2)]
  1074.   End If 
  1075. End Proc
  1076. Procedure DISGAD[BT]
  1077.   FB(BT,4)=FB(BT,4) and $FE
  1078. End Proc
  1079. Procedure ENAGAD[BT]
  1080.   FB(BT,4)=FB(BT,4) or 1
  1081. End Proc
  1082. Procedure CLRGAD[BT]
  1083.   FB(BT,4)=FB(BT,4) and $FE
  1084.   Ink 2 : Bar FB(BT,0),FB(BT,1) To FB(BT,2),FB(BT,3)
  1085. End Proc
  1086. Procedure PUSHGAD[BT]
  1087.   DRABOX[FB(BT,0),FB(BT,1),FB(BT,2),FB(BT,3),1]
  1088. End Proc
  1089. Procedure RELEGAD[BT]
  1090.   DRABOX[FB(BT,0),FB(BT,1),FB(BT,2),FB(BT,3),0]
  1091. End Proc
  1092. Procedure FILBOX[X1,Y1,X2,Y2,SE]
  1093.   Ink 2 : Bar X1+2,Y1+1 To X2-2,Y2-1
  1094.    Extension_8_0388 X1,Y2,2
  1095.    Extension_8_0388 X2,Y1,2
  1096.   Ink 1+SE*2 : Draw X1,Y2-1 To X1,Y1 : Draw To X2-1,Y1 : Draw X1+1,Y2-1 To X1+1,Y1
  1097.   Ink 3-SE*2 : Draw X1+1,Y2 To X2,Y2 : Draw To X2,Y1+1 : Draw X2-1,Y2 To X2-1,Y1+1
  1098. End Proc
  1099. Procedure NEWTEX[BT,T$]
  1100.   FB$(BT)=T$
  1101.   TEX[FB(BT,0)+1,FB(BT,1),FB(BT,2)-1,FB(BT,3),T$]
  1102. End Proc
  1103. Procedure TEXBOX[X1,Y1,X2,Y2,SE,T$]
  1104.   TEX[X1+1,Y1,X2-1,Y2,T$]
  1105.    Extension_8_0388 X1,Y2,2 : Extension_8_0388 X2,Y1,2
  1106.   Ink 1+SE*2 : Draw X1,Y2-1 To X1,Y1 : Draw To X2-1,Y1 : Draw X1+1,Y2-1 To X1+1,Y1
  1107.   Ink 3-SE*2 : Draw X1+1,Y2 To X2,Y2 : Draw To X2,Y1+1 : Draw X2-1,Y2 To X2-1,Y1+1
  1108. End Proc
  1109. Procedure TEX[X1,Y1,X2,Y2,T$]
  1110.   If Asc(T$)=123
  1111.     M=1 : T$=Mid$(T$,2)
  1112.   Else 
  1113.     If Asc(T$)=125
  1114.       M=2 : T$=Mid$(T$,2)
  1115.     Else 
  1116.       M=0
  1117.     End If 
  1118.   End If 
  1119.   TL=Text Length(T$)
  1120.   While TL>(X2-X1)-4
  1121.     T$=Left$(T$,Len(T$)-1)
  1122.     TL=Text Length(T$)
  1123.   Wend 
  1124.   If M=1
  1125.     X=X1+4 : Y=Y1+1
  1126.   Else 
  1127.     If M=2
  1128.       X=X2-Text Length(T$)-2 : Y=Y1+1
  1129.     Else 
  1130.       X=(X1+X2-TL)/2 : Y=(Y1+Y2-TH+1)/2
  1131.     End If 
  1132.   End If 
  1133.   If Y2>0 Then Ink 2 : Bar X1+1,Y1+1 To X2-1,Y2-1
  1134.   Ink 0 : Text X,Y+Text Base,T$
  1135. End Proc
  1136. Procedure TEX2[X1,Y1,X2,Y2,T$]
  1137.   If Asc(T$)=123
  1138.     M=1 : T$=Mid$(T$,2)
  1139.   Else 
  1140.     If Asc(T$)=125
  1141.       M=2 : T$=Mid$(T$,2)
  1142.     Else 
  1143.       M=0
  1144.     End If 
  1145.   End If 
  1146.   TL=Text Length(T$)
  1147.   While TL>(X2-X1)-4
  1148.     T$=Left$(T$,Len(T$)-1)
  1149.     TL=Text Length(T$)
  1150.   Wend 
  1151.   If M=1
  1152.     X=X1+4 : Y=Y1+1
  1153.   Else 
  1154.     If M=2
  1155.       X=X2-Text Length(T$)-2 : Y=Y1+1
  1156.     Else 
  1157.       X=(X1+X2-TL)/2 : Y=(Y1+Y2-TH+1)/2
  1158.     End If 
  1159.   End If 
  1160.   If Y2>0 Then Ink 2 : Bar X1+1,Y1+1 To X2-1,Y2-1
  1161.   Ink 1 : Text X,Y+Text Base,T$
  1162. End Proc
  1163. Procedure DRABOX[X1,Y1,X2,Y2,SE]
  1164.   Ink 1+SE*2 : Draw X1,Y2-1 To X1,Y1 : Draw To X2-1,Y1 : Draw X1+1,Y2-1 To X1+1,Y1
  1165.   Ink 3-SE*2 : Draw X1+1,Y2 To X2,Y2 : Draw To X2,Y1+1 : Draw X2-1,Y2 To X2-1,Y1+1
  1166. End Proc
  1167. Procedure STRGAD[BT,I$]
  1168.   Shared POS
  1169.   A$=FB$(BT)
  1170.   If I$=""
  1171.     POS=Len(A$)-1
  1172.   End If 
  1173.   If I$>Chr$(31) Then A$=Left$(A$,POS+1)+I$+Mid$(A$,POS+2) : Inc POS
  1174.   If I$=Chr$(8) and POS>0 Then A$=Left$(A$,POS)+Mid$(A$,POS+2) : Dec POS
  1175.   If I$=Cleft$ and POS>0 Then Dec POS
  1176.   If I$=Cright$ and POS<Len(A$)-1 Then Inc POS
  1177.   If I$=Chr$(13)
  1178.     NEWTEX[BT,A$]
  1179.     Pop Proc[-1]
  1180.   End If 
  1181.   NEWTEX[BT,A$]
  1182.   X1=FB(BT,0)+5+Text Length(Mid$(A$,2,POS)) : Y1=FB(BT,1)+1
  1183.   X2=X1+Max(Text Length(Mid$(A$,POS+2,1)),4)
  1184.   If X2<FB(BT,2)-4
  1185.     Gr Writing 2
  1186.     Ink 3 : Bar X1,Y1 To X2-1,Y1+TH-1
  1187.     Gr Writing 0
  1188.   End If 
  1189. End Proc[0]
  1190. Procedure DEFCLOWIN[BT,X,Y]
  1191.   DRACLOWIN[X,Y]
  1192.   DEFGAD[BT,X,Y,X+18,Y+TH+2,1]
  1193. End Proc
  1194. Procedure DRACLOWIN[X,Y]
  1195.   FILBOX[X,Y,X+18,Y+TH+2,0]
  1196.   Ink 0 : Box 7+X,3+Y To 11+X,Y+TH-1
  1197. End Proc
  1198. Procedure DEFSCRTBK[BT,X,Y]
  1199.   DRASCRTBK[X,Y]
  1200.   DEFGAD[BT,X,Y,X+22,Y+TH+2,1]
  1201. End Proc
  1202. Procedure DRASCRTBK[X,Y]
  1203.   FILBOX[X,Y,X+22,Y+TH+2,0]
  1204.   Ink 0 : Box 4+X,2+Y To 14+X,Y+TH/2+2
  1205.   Ink 2 : Bar 8+X,Y+TH/2 To 18+X,Y+TH
  1206.   Ink 0 : Box 8+X,Y+TH/2 To 18+X,Y+TH
  1207. End Proc
  1208. Procedure DEFARROWU[BT,X,Y]
  1209.   DRAARROWU[X,Y]
  1210.   DEFGAD[BT,X,Y,X+17,Y+8,3]
  1211. End Proc
  1212. Procedure DRAARROWU[X,Y]
  1213.   DRABOX[X,Y,X+17,Y+8,0]
  1214.    Extension_8_1016 X+4,Y+6 To X+8,Y+2,0
  1215.    Extension_8_1016 X+5,Y+6 To X+8,Y+3,0
  1216.    Extension_8_1016 X+9,Y+2 To X+13,Y+6,0
  1217.    Extension_8_1016 X+9,Y+3 To X+12,Y+6,0
  1218. End Proc
  1219. Procedure DEFARROWD[BT,X,Y]
  1220.   DRAARROWD[X,Y]
  1221.   DEFGAD[BT,X,Y,X+17,Y+8,3]
  1222. End Proc
  1223. Procedure DRAARROWD[X,Y]
  1224.   DRABOX[X,Y,X+17,Y+8,0]
  1225.    Extension_8_1016 X+4,Y+2 To X+8,Y+6,0
  1226.    Extension_8_1016 X+5,Y+2 To X+8,Y+5,0
  1227.    Extension_8_1016 X+9,Y+6 To X+13,Y+2,0
  1228.    Extension_8_1016 X+9,Y+5 To X+12,Y+2,0
  1229. End Proc
  1230. Procedure DRAPROCBAR[BT,POS,MX]
  1231.   X1=FB(BT,0)+2 : X2=FB(BT,2)-2 : Y1=FB(BT,1)+1 : Y2=FB(BT,3)-1
  1232.   DX=X2-X1
  1233.   PX=X1+(POS*DX)/MX
  1234.   If PX>X1 and PX<X2
  1235.     Ink 0 : Bar X1,Y1 To PX,Y2
  1236.     Ink 2 : Bar PX,Y1 To X2,Y2
  1237.   End If 
  1238.   If PX=X1 Then Ink 2 : Bar X1,Y1 To X2,Y2
  1239.   If PX=X2 Then Ink 0 : Bar X1,Y1 To X2,Y2
  1240. End Proc
  1241. Procedure DRASLIDER[BT,LINOFF,PAG,NUMLIN,NB]
  1242.   D=(FB(BT,3)-FB(BT,1))-4
  1243.   Y1=(LINOFF*D)/Max(NUMLIN,PAG)+FB(BT,1)+2
  1244.   Y2=((LINOFF+PAG)*D)/Max(NUMLIN,PAG)+FB(BT,1)+2
  1245.   DEFGAD[NB,FB(BT,0)+4,Y1,FB(BT,2)-4,Y2,3]
  1246.   Ink 2
  1247.   If Y1>FB(BT,1)+2 Then Bar FB(BT,0)+4,FB(BT,1)+1 To FB(BT,2)-4,Y1-1
  1248.   If Y2<FB(BT,3)-2 Then Bar FB(BT,0)+4,Y2+1 To FB(BT,2)-4,FB(BT,3)-1
  1249.   If Y2-Y1>0
  1250.     Ink 0 : Bar FB(BT,0)+4,Y1 To FB(BT,2)-4,Y2
  1251.   Else 
  1252.      Extension_8_1016 FB(BT,0)+4,Y1 To FB(BT,2)-4,Y2,0
  1253.   End If 
  1254. End Proc
  1255. Procedure DRAGSLIDER[BT,Y,PAG,NUMLIN,NB]
  1256.   Y1=FB(NB,1) : Y2=FB(NB,3) : D=Y2-Y1
  1257.   Y1=Min(Max(FB(BT,1)+2,Y),FB(BT,3)-2-D)
  1258.   Y2=Y1+D : FB(NB,1)=Y1 : FB(NB,3)=Y2
  1259.   Ink 2
  1260.   If Y1>FB(BT,1)+2 Then Bar FB(BT,0)+4,FB(BT,1)+1 To FB(BT,2)-4,Y1-1
  1261.   If Y2<FB(BT,3)-2 Then Bar FB(BT,0)+4,Y2+1 To FB(BT,2)-4,FB(BT,3)-1
  1262.   If Y2-Y1>0
  1263.     Ink 1 : Bar FB(BT,0)+4,Y1 To FB(BT,2)-4,Y2
  1264.   Else 
  1265.      Extension_8_1016 FB(BT,0)+4,Y1 To FB(BT,2)-4,Y2,1
  1266.   End If 
  1267.   D=FB(BT,3)-FB(BT,1)-4
  1268.   L=Min(((Y1-FB(BT,1)-2)*Max(NUMLIN,PAG)+D/2)/D,NUMLIN-PAG)
  1269. End Proc[L]